package main

import "fmt"

type MyInt1 int   //基于基本类型 int 创建了新类型 MyInt1
type MyInt2 = int //创建的一个 int 的类型别名 MyInt2
type user struct {
}
type MyUser user

func (user MyUser) userFunc() {
	fmt.Println("user.userFunc()")
}

func Add1(a, b int) int {
	return a + b
}

func (a MyInt1) Add2(b MyInt1) MyInt1 {
	return a + b
}

func main() {
	var a int = 1
	var b MyInt2 = 2
	var c, d MyInt1 = 1, 2
	var e int = Add1(a, b)
	var f MyInt1 = c.Add2(d)
	fmt.Printf("Add(1,2) = %v\n1.Add(2) = %v\n", e, f)
	var user MyUser
	user.userFunc()
}
